## Controller Python Script "createPost"
##bind container=container
##bind context=context
##bind namespace=
##bind script=script
##bind state=state
##bind subpath=traverse_subpath
##parameters=id=None,type_name=None,script_id=None
##title=redirect simply to the correct template
##

REQUEST  = context.REQUEST
props    = context.portal_properties.site_properties
encoding = props.getProperty('default_charset', 'utf-8')

# set correct encoding for request
REQUEST.RESPONSE.setHeader('content-type',
                           'text/html; charset=%s' % encoding)


# Handles quote and replies
if context.portal_type != 'PGForum':
    
    default_title = "Re: %s" % context.Title()
    REQUEST.set('item_title', default_title)
    
    if not context.portal_membership.isAnonymousUser():
        if hasattr(REQUEST, 'quote'):
            REQUEST.set('body_text',
                        context.plonegossip_quote(parent = context))

return state.set(status='success')
